Skip to content

ui8kit codegen 2.0: port the xgen engine (8 runtimes), ThemeToggle + Sheet, 8+4 grid gate - #1

Merged
alexy-os merged 8 commits into
mainfrom
xgen-2
Oct 18, 2026
Merged

alexy-os merged 8 commits into
mainfrom
xgen-2

Conversation

@alexy-os

@alexy-os alexy-os commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Ports the xgen generation layer of ui8kit 2.0 from codegen-x/ui8kit (main @ 18d9e650, folder /xgen) into ui8kit/codegen as a standalone Bun workspace, and bumps the package to 2.0.0 (not published to npm). The 0.1 engine is replaced; it stays reachable at 972b492 (the SHA saas-design pins).

What is ported

  • Engine (xgen/): @ui8kit/xgen-schema (JSON Schemas, Codex manifest, codex/blocks.json, @ui8kit/contract v0.4 validation), xgen-spec (brick loader, canonical renderer, 0.1 importer), xgen-screens (view IR + builder of parts, patterns, organisms, blocks, presets, screens), xgen-generator, xgen-check, xgen CLI, and the runtimes svelte, react, vue, solid, templ, twig, latte, jinja2 (+ runtimes/core).
  • Specs and data: 40 bricks / 72 parts, 23 parts, 36 patterns, 184 organisms, 92 blocks (474 variants), 16 recipes, 15 screens; 77 Codex fixture collections (733 entries), the dictionary, Lucide registry, 15 skins + default.
  • Generated, committed outputs (bun run build, DO NOT EDIT, drift-checked): packages/{svelte,react,vue,solid}/ui, packages/{templ,twig,jinja2,latte}/ui, packages/shared/app, apps/host-{svelte,react,vue,solid}.
  • Gates: rules/ (zones, baselines, self-test fixtures, html-validate), packages/tooling (rules, zones, ui8px gate, pre-push audit), .ui8px policy, .githooks/pre-push, CI (bun run verify with Go, PHP 8.4 + composer and Python 3.13; UI8KIT_REQUIRE_ALL_RUNTIMES=1).
  • Docs: new README, docs/ (architecture, runtimes, cli, contract, registry, specs-guide), MIGRATION.md (0.1 -> 2.0, with the saas-design steps).

Standalone changes vs the monorepo

  • Go module github.com/ui8kit/codegen/packages/templ/ui (was github.com/codegen-x/ui8kit/...).
  • Monorepo-only targets and gates switch on only when those packages exist: the taste copy-deck target (packages/taste-data), the magazine style zone; codex/blocks.json regenerated without the magazine/taste surfaces; tests read the workspace instead of assuming apps/magazine.
  • @ui8kit/contract is a runtime dependency of xgen-schema; verify also runs codex:validate and the full typecheck.
  • LICENSE holder: UI8Kit.

Upstreamed from saas-design

  • ThemeToggle (ui.themetoggle) and Sheet (ui.sheet: Sheet, SheetTrigger, SheetClose) bricks, imported from saas-design/packages/ui/bricks with spec/tools/import-codegen.ts, token-only (semantic ui-* classes replaced by the utilities they applied), same DOM/ARIA/data-ui8kit hooks, generated for all 8 runtimes and parity-checked.
  • Half steps: xgen bricks are on the 8 + 4 grid (0.1 gap-1.5 in Button sm and CardHeader is gone); new spacing gate + test fail on any x.5 step in specs, builder or kit assets, so saas-design's SNAP map is no longer needed.
  • Svelte Link a11y_no_noninteractive_tabindex warning silenced in the emitter (svelte-check: 0 errors, 0 warnings).

Breaking changes (details in MIGRATION.md)

  • Brick source: bricks/*.def.ts DSL -> xgen/specs/ui/*.json; deep imports bricks/index, bricks/_dsl, src/domain/validate, src/emitters/*, tests/support/* are gone (use loadSpecs, planBuild/write, the @ui8kit/xgen-runtime-* emitters).
  • Output: generated/ui/<brick>/ -> one package per runtime; kebab-case file names; templ v0.3.1001 -> v0.3.1070; Go module path changed.
  • Recipes: controls h-8/h-10/h-12, one corner token rounded, no shadows on flat surfaces, Button layout axis replaces size icon.
  • Removed: examples/, static HTML export, generate:latte-bundle.
  • New runtime: Jinja2; Latte/Twig no longer skip Breadcrumb/Select/Icon.

Verify results (local, Bun 1.4.2, Go, PHP 8.4.26, Python 3.13.5, UI8KIT_REQUIRE_ALL_RUNTIMES=1)

  • bun run check: xgen check: ok, all 31 groups. Parity: templ, solid, twig, jinja2, latte each 123 brick cases + 474 block cases (224 organisms) render the same DOM as React; 474 documents pass html-validate per runtime.
  • bun run codex:validate: 733 entries, 8 menus (63 items), 62 kinds, 4 taxonomies: 0 errors, 0 warnings.
  • bun run typecheck: xgen tsc ok; svelte-check (svelte-ui, host-svelte) 0 errors, 0 warnings; tsc / vue-tsc on react, solid, vue, shared app and hosts ok.
  • bun test xgen: 821 pass, 0 fail (18,481 expects, 34 files).
  • audit:push: ok (no private files, binaries or secrets).
  • Not run: bun run e2e / visual (Playwright browsers), build:hosts.

Registry / site

ui8kit/site (registry/, ui.buildy.tw, registry.buildy.tw) builds from a --src checkout with exactly this layout (packages/*/ui, packages/shared/app, xgen/specs, xgen/screens/src/authoring/screens/themes.ts, apps/host-*/xgen/screens). It can later build from ui8kit/codegen instead of the private monorepo: bun run registry:build -- --src ../codegen (see docs/registry.md). Expected difference: +2 primitives (themetoggle, sheet).

Left out (monorepo internals)

apps/magazine, apps/discovery, packages/panorama, packages/taste-data, packages/taste-screens, plan/, .cursor/, shots.

Brings the xgen packages of codegen-x/ui8kit (main 18d9e650) into ui8kit/codegen:
schema (JSON Schemas, Codex manifest and block data, @ui8kit/contract v0.4 validation),
spec (loader and canonical renderer), screens (view IR builder, authoring of organisms,
blocks, presets and screens), generator, check, cli and the runtimes svelte, react, vue,
solid, templ, twig, jinja2, latte; plus rules/, packages/tooling, the ui8px policy and
the root Bun workspace.

Standalone changes: the Go module is github.com/ui8kit/codegen/packages/templ/ui; the
taste-data copy-deck target and the magazine style zone apply only when those packages
exist; blocks.json regenerated without the monorepo-only surfaces; tests read the
workspace instead of assuming apps/magazine; the 0.1 engine (bricks/, src/, runtime/,
generated/, examples/, tests/) is removed (still at 972b492 on main).
Version 2.0.0 (not published); LICENSE holder UI8Kit.
packages/{svelte,react,vue,solid}/ui, packages/{templ,twig,jinja2,latte}/ui,
packages/shared/app and apps/host-{svelte,react,vue,solid}, written by xgen build
from xgen/specs (DO NOT EDIT; the drift group of xgen check keeps them equal to the
regeneration). Go module github.com/ui8kit/codegen/packages/templ/ui.
ui.themetoggle (ThemeToggle) and ui.sheet (Sheet, SheetTrigger, SheetClose), imported
with spec/tools/import-codegen.ts from saas-design packages/ui/bricks (the 0.1 brick DSL)
and turned into token-only xgen specs: the semantic ui-* classes of the saas-design
adapter are replaced by the utilities they applied (sun/moon by dark:, the trigger
icons by in-aria-expanded:), rounded-full -> rounded (one corner token), the sheet
panel shadow-xl -> shadow-lg (allowlisted: a floating layer). Same DOM, ARIA and
data-ui8kit hooks as saas-design; Lucide sun, moon, menu and x glyphs inline.
Examples cover every variant and size; generated for all eight runtimes and checked
by templ, solid, twig, jinja2 and latte parity. 40 bricks, 72 parts.
The upstream 0.1 bricks used gap-1.5 (button sm, card header), which saas-design
snapped to gap-2 in packages/ui/scripts/registry.ts (backlog codegen-half-steps.md).
The xgen specs are already on the grid (button sm h-8 px-3, card header gap-2); the
spacing group of xgen check now fails on any fractional step (gap-1.5, px-2.5,
size-3.5, -mt-0.5 ...) in xgen/specs, xgen/screens/src and the runtime assets, so
the SNAP workaround is no longer needed. Test: check/test/half-steps.test.ts.
…of xgen-schema

bun run verify = xgen check + codex:validate (every Codex v0.4 fixture through
validateCollectionV04 of @ui8kit/contract) + typecheck:xgen + bun test xgen.
@ui8kit/contract ^0.2.0 moves from devDependencies to dependencies: codex-validate.ts
imports it outside tests.
README presents the 2.0 surface (8 runtimes, counts, quick start, layout, design rules,
Codex contract) aligned with the public registry ui.buildy.tw / ui8kit CLI 2.0.x.
docs/: architecture, runtimes, cli, contract, registry (how ui8kit/site could build its
registry from this repository instead of the private monorepo), specs-guide.
MIGRATION.md: what changed from 0.1, the engine API mapping, recipe/DOM changes, and
the steps for saas-design (local ThemeToggle/Sheet bricks upstream, SNAP removal,
templ v0.3.1070, open items). xgen READMEs note the monorepo-only surfaces.
…ify runs the full typecheck

- themetoggle/sheet: drop focusable="false" from the inline Lucide SVGs (not an SVG
  attribute in Solid's JSX types; aria-hidden already hides the glyphs), so
  tsc -p packages/solid/ui passes.
- svelte emitter: an anchor whose href arrives through {...rest} and carries a tabindex
  gets <!-- svelte-ignore a11y_no_noninteractive_tabindex --> (Link, LinkPlain): the
  saas-design backlog item codegen-svelte-link-a11y-tabindex; svelte-check now reports
  0 errors and 0 warnings for @ui8kit/svelte-ui and host-svelte.
- bun run verify = check + codex:validate + typecheck (xgen tsc, svelte-check, tsc,
  vue-tsc on the packages, the shared app and the hosts) + test.
@alexy-os
alexy-os merged commit 2309848 into main Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants